#include "task.hpp"
//#include "threadpool_V1.hpp"
// #include "threadpool_V2.hpp"
//#include "threadpool_V3.hpp"
#include "threadpool_V4.hpp"



#include <string.h>

using namespace std;
const char* ops = "+-*/%";
int main()
{
    srand(time(0));
    // threadPool<Task>* tp = new threadPool<Task>();
    // tp->init();
    // tp->start();
    //threadPool<Task>::getinstacne();

    while(1)
    {
        int x = rand()%100;
        int y = rand()%100;
        char op = ops[rand() % 5];
        cout << x << op << y << "=?" << endl;
        Task t(x, y, op);
        //tp->pushTask(t);//推送任务
        sleep(7);
        threadPool<Task>::getinstacne()->pushTask(t);//使用时才会创建线程池---懒汉模式

        sleep(1);
    }

    return 0;
}